package com.anche.cywebnew.Utils.query;

import com.alibaba.fastjson2.JSONObject;


public class GetState
{
	private static String URL = "http://56.32.4.182:8021/sms-boot/sms/send/getSmState";
	
	public static void main(String[] args)
	{
		String userName = "用户名";
		String password = "密码";
		String id = "发送之后返回的ID值";
		
		getState(userName, password, id);
	}
	
	public static void getState(String userName, String passWord, String id)
	{
		String token = MakeToken.getToken(userName, passWord);
		if (token.length() > 1)
		{
			JSONObject param = new JSONObject();
			param.put("id", id);
			
			String response = HttpUtil.post(URL, token, param.toString());
			JSONObject obj = JSONObject.parseObject(response);
			
			/*
			 * {"success":true,"message":"","code":0,"result":{"id":"1699292347744210945","srcmobile":"13000000000","state":0,"longId":"特服号","chargeCount":1,"reportTime":"2023-09-06 13:24:17"},"timestamp":1697169384480}
			 */
			if (0 == obj.getIntValue("code"))
			{
				JSONObject result = obj.getJSONObject("result");
				// {"id":"1699292347744210945","srcmobile":"13000000000","state":0,"longId":"特服号","chargeCount":1,"reportTime":"2023-09-06 13:24:17"}
				System.out.println(result);
			}
		}
	}
}
